<?php 
require_once "dbconfig.php";
require_once "computationHelper.php";
$method;
if($_POST["method"]){
	$method = $_POST["method"];
}else{
	$method = $_GET["method"];
}
 if($method=="insert"){
	$sex = $_POST['sex'];
	$age = $_POST['age'];
	$height = $_POST['height'];
	$weight = $_POST['weight'];
	$out_id = $_POST['outId'];
	$computationHelper = new ComputationHelper($sex,$age,$height,$weight); 
    $superRank = $computationHelper->getSuperRank();
	$sqlInsert = "insert into user_health(age,sex,height,weight,type,out_id,super_rank) values(".$age.",'".$sex."',".$height.",".$weight.",'x','".$out_id."','".$superRank."')";
	echo $sqlInsert;
	$flag = mysql_db_query($database, $sqlInsert);
	header("Location: http://apps.xiaonei.com/dongdong?isnet=y");
}
?>